HTMLify

index.html
Views: 279 | Author: deepika
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="QR CODE.css">
    <title>Document</title>
</head>
<body>
      <div class="container">
        <p>Enter your text or URL</p>
        <input type="text" placeholder="Text or URL" id="qrtext">
        <div id="imgBox">
          <img src="" id="qrimg">
        </div>
        <button onclick="generateQR()">Generate QR Code</button>
      </div>
      <script>

        let imgBox=document.getElementById("imgBox")
        let qrimg=document.getElementById("qrimg")
        let qrtext=document.getElementById("qrtext")
        function generateQR(){
                if(qrtext.value.length>0){
                qrimg.src = "https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=" + qrtext.value;
                imgBox.classlist.add("show-img");
              }
            }
      </script>
</body>
</html>

Comments